package com.ftn;

import java.awt.*;

/**
 * User: Jack Fu
 * Date: 2024/9/5
 * Time: 14:47
 * To change this template use File | Settings | File Templates.
 * Description:
 */
public class ShellObj extends GameObj{

    public ShellObj() {
        setImage(GameUtils.zidan1Image);
        setX(235);
        setY(550);
        setWidth(25);
        setHeight(97);
        setSpeed(5);
    }

    public ShellObj(int x, int y, int width, int height, Image image, int speed, GameWin gameWin) {
        super(x, y, width, height, image, speed, gameWin);
    }

    public ShellObj(int x, int y, Image image, int speed) {
        super(x, y, image, speed);
    }

    @Override
    public void paintSelf(Graphics g) {
        super.paintSelf(g);
        y -= speed;

        if (y < 0) {
            // 子弹从窗口消失
            GameUtils.removeObjs.add(this);
        }
    }

    @Override
    public Rectangle getRec() {
        return super.getRec();
    }
}
